import { useState, useEffect } from 'react'
import { resourcePath } from '../../../../../../../utils/resource';
import { Table } from 'antd';
import useBusinessMap from '../../../../../../common/BusinessMap/useBusinessMap';
import { navByWkt } from '../../../../../../../utils/helper/mapHelper';
import JcyjApi from '../../../../../../../utils/apis/JcyjApi';
export default function Huodian(props) {
    const [datas, setDatas] = useState();

    const [params, setParams] = useState({
        pagesize: 5,
        pagestart: 1
    });
    const [total, setTotal] = useState();

    useEffect(() => {
        JcyjApi.huodian_datafindby(params).then(resp => {
            setDatas(resp.data)
            setTotal(resp.data2?.totalsize);
        });
    }, [params])

    const map = useBusinessMap();

    return <div>
        <div style={{
            background: `url(${resourcePath.blockTitleBg})`,
            height: 36,
            backgroundSize: '100% 100%',
            fontSize: 18,
            lineHeight: '36px',
            paddingLeft: 12,
            fontWeight: "bold"
        }}>
            火点监测（<span>{total}</span>）
        </div>
        <div style={{
            padding: 12
        }}>
            <Table  columns={[
                {
                    title: '序号',
                    dataIndex: 'xh',
                    render: (text) => {
                        return text
                    }
                },
                {
                    title: '地址',
                    dataIndex: 'address',
                    render: (text) => {
                        return text
                    }
                },
                {
                    title: '时间',
                    dataIndex: 'time',
                    render: (text) => {
                        return text
                    }

                },
                {
                    title: '操作',
                    dataIndex: 'cz',
                    render: (text) => {
                        return text
                    }

                },


            ]} dataSource={datas}
                size="small"
                bordered
                onRow={record => {
                    return {
                        onClick: e => {
                            if (record.shp) {
                                navByWkt(record.shp, map)
                            }
                        }
                    }
                }}
                pagination={{
                    current: params.pagestart,
                    pageSize: params.pagesize,
                    total,
                    simple: true
                }}
            />
        </div>
    </div>;
}